from fastapi import FastAPI, HTTPException, status
from tortoise.contrib.fastapi import register_tortoise
from src.config import settings
from src.api import test_router, question_router, paper_router
import uvicorn
from src.api.test_paper import app02,app03,app04
from src.config.settings import TORTOISE_ORM
from tortoise.transactions import in_transaction
main_api = FastAPI()

main_api.include_router(test_router.test_router, prefix='/TEST', tags=['API启动测试'])
main_api.include_router(question_router.question_router, prefix='/Question', tags=['题目表'])
main_api.include_router(question_router.better_question_router, prefix='/BetterQuestion', tags=['题目进阶'])
main_api.include_router(paper_router.paper_router, prefix='/Paper', tags=['试卷'])




main_api.include_router(app02, prefix="/crud", tags=["试卷表基本curd"])
main_api.include_router(app03, prefix="/kaoshicrud", tags=["考试表基本curd"])
main_api.include_router(app04, prefix="/ai", tags=["AI阅卷工作流"])
register_tortoise(
    app =  main_api,
    config=TORTOISE_ORM,
)

if __name__ == '__main__':
    uvicorn.run("main:main_api", host="127.0.0.1", port=8000)
